package com.atguigu.tingshu.album.api;

import com.atguigu.tingshu.album.service.FileUploadApiService;
import com.atguigu.tingshu.common.execption.GuiguException;
import com.atguigu.tingshu.common.result.Result;
import io.minio.BucketExistsArgs;
import io.minio.MakeBucketArgs;
import io.minio.MinioClient;
import io.minio.UploadObjectArgs;
import io.minio.errors.MinioException;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@Tag(name = "上传管理接口")
@RestController
@RequestMapping("api/album")
public class FileUploadApiController {
    @Autowired
    private FileUploadApiService fileUploadApiService;

    /**
     * 上传文件
     * /api/album/fileUpload
     * @param file
     * @return
     */
    @PostMapping("/fileUpload")
    public Result<String> FileUploadApiController(MultipartFile file){
       String url= fileUploadApiService.FileUploadApiController(file);
        return Result.ok(url);
    }
}
